package com.feilong.cn.mybatis.autoV2.executor;


import com.feilong.cn.mybatis.autoV2.handler.AutoSimpleStatementHandler;
import com.feilong.cn.mybatis.autoV2.session.AutoSqlSession;
import com.feilong.cn.mybatis.autoV2.statement.MappedStatement;

/**
 * Created by yangxulong on 2018/4/2.
 */
public class BaseExecutor implements IExecutor {

    private AutoSqlSession session;

    public BaseExecutor(AutoSqlSession session) {
        this.session = session;
    }

    @Override
    public <T> T doQuery(String stateMent, Object parameter) {

//        MappedStatement mappedStatement = session.getConfiguration().getMappedStatement(stateMent);
        AutoSimpleStatementHandler handler = new AutoSimpleStatementHandler(session.getConfiguration());

        return (T) handler.query(stateMent, parameter);

    }
}
